package com.chao.rsa2demo.encrypt.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: cjp
 * @create: 2024-11-12 10:30
 * @description: TODO
 */
@Getter
@AllArgsConstructor
public enum ErrorEnum {

    //加验签
    SIGN_TYPE_ERROR("SIGN_TYPE_ERROR", "无效的非对称加密类型[signType]:[%s]，可选值为：RSA、RSA2和SM2。"),
    ENCRYPT_TEXT_EMPTY_ERROR("ENCRYPT_TEXT_EMPTY_ERROR", "密文不可为空"),
    SIGN_TEXT_EMPTY_ERROR("SIGN_TEXT_EMPTY_ERROR", "待签名内容不可为空"),
    VERIFY_TEXT_EMPTY_ERROR("VERIFY_TEXT_EMPTY_ERROR", "待验签内容不可为空"),
    SIGN_PRIVATE_KEY_EMPTY_ERROR("SIGN_PRIVATE_KEY_EMPTY_ERROR", "私钥[privateKey]不可为空"),
    SIGN_PUBLIC_KEY_EMPTY_ERROR("SIGN_PUBLIC_KEY_EMPTY_ERROR", "公钥不可为空"),
    SIGN_EMPTY_ERROR("SIGN_EMPTY_ERROR", "签名串不可为空"),
    DECRYPT_ERROR("DECRYPT_ERROR", "%s非对称解密遭遇异常，请检查私钥格式是否正确。%s cipherTextBase64=%s，charset=%s，privateKeySize=%d"),
    ENCRYPT_ERROR("ENCRYPT_ERROR", "%s非对称加密遭遇异常，请检查公钥格式是否正确。%s plainText=%s，charset=%s，publicKey=%s"),
    SIGN_ERROR("SIGN_ERROR", "%s签名遭遇异常，请检查私钥格式是否正确。%s content=%s，charset=%s，privateKeySize=%d"),
    VERIFY_ERROR("VERIFY_ERROR", "%s验签遭遇异常，请检查公钥格式或签名是否正确。%s content=%s，charset=%s，publicKey=%s，sign=%s"),
    SIGN_CHARSET_ERROR("SIGN_CHARSET_ERROR", "%s签名遭遇异常，请检查编码格式是否正确。 charset=%s"),

    //加解密
    ENCRYPT_IS_NEED_ERROR("ENCRYPT_IS_NEED_ERROR", "当前API不支持加密请求"),
    ENCRYPT_EMPTY_ERROR("ENCRYPT_EMPTY_ERROR", "API请求要求加密，则必须设置密钥类型[encryptType]和加密密钥[encryptKey]"),
    ENCRYPT_TYPE_ERROR("ENCRYPT_TYPE_ERROR", "当前不支持该算法类型：encrypeType="),
    RESPONSE_BODY_EMPTY_ERROR("RESPONSE_BODY_EMPTY_ERROR", "响应字符串为空"),
    ENCRYPT_ASE_ERROR("ENCRYPT_ASE_ERROR", "AES加密失败：Aescontent = %s; charset = %s"),
    ENCRYPT_ASE_CHARSET_ERROR("ENCRYPT_ASE_CHARSET_ERROR", "AES加密失败，请检查编码格式是否正确：charset = %s"),
    DECRYPT_ASE_ERROR("DECRYPT_ASE_ERROR", "AES解密失败：Aescontent = %s; charset = %s"),
    ENCRYPT_ASE_V2_ERROR("ENCRYPT_ASE_V2_ERROR", "AES_V2加密失败：Aescontent = %s; charset = %s"),
    DECRYPT_ASE_V2_ERROR("DECRYPT_ASE_V2_ERROR", "AES_V2解密失败：Aescontent = %s; charset = %s"),
    ENCRYPT_SM4_ERROR("ENCRYPT_SM4_ERROR", "SM4加密失败：Aescontent = %s; charset = %s"),
    DECRYPT_SM4_ERROR("DECRYPT_SM4_ERROR", "SM4解密失败：Aescontent = %s; charset = %s"),
        ;

    private String errCode;
    private String errMsg;
}
